package org.javaboy.java8;

import lombok.extern.slf4j.Slf4j;

import java.util.HashMap;
import java.util.Map;
import java.util.StringJoiner;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.IntStream;

public class Java8Demo {
    public static void main(String[] args) {
        StringJoiner sj = new StringJoiner(",");
        IntStream.range(1,10).forEach(i->sj.add(i+""));
        System.out.println(sj);

        //值依次是分割符 , 前缀  ,后缀
        StringJoiner stringJoiner = new StringJoiner(",", "[", "]");
        stringJoiner.add("xiao");
        stringJoiner.add("zhi");
        System.out.println(stringJoiner);

        StringJoiner joiner3 = new StringJoiner("','", "'", "'");
        joiner3.add("1").add("2");
        System.out.println(joiner3);
    }

}